<html>
<body>
<?php
require_once("config.php");
require_once("utils.php");


$directory_name=$upload_path;
$db=new SQLite3($dbfilename);

// get file list

$filelist=directoryToArray($directory_name,true);
foreach ($filelist as $filename) {
  if (!is_dir($filename)) {
    $v_filesize=filesize($filename);
    $v_md5sum=md5_file($filename);
    echo "<a href=\"" . $filename . "\">" . basename($filename) . "</a> <br/>";

// check duplicates
    $results=$db->query("SELECT * FROM item_t WHERE md5sum = '$v_md5sum'");
    $row=$results->fetchArray();
    if ($row[0]>0) {
      if ($row['pfn'] !== $filename) {
        echo " found in database with different physical filename <i>" . $row['pfn'] . "</i><br/> ";
      }
    }
  }
}


$db->close();
?>

<a href="index.html">back</a>

</body>
</html>
